{% extends "analysis_plugins/general_information.html" %}

{% block analysis_result_details %}

    {% for match in analysis_result.matches %}
        <tr>
            <td class="table-head-light">Description</td>
            <td class="table-head-light">{{ match.rule }}</td>
        </tr>
        <tr>
            <td rowspan={{ match.count + 1 }}>Content</td>
        </tr>
        {% for material in match.material %}
            <tr>
                <td class="m-0 p-0">
                    <pre class="border rounded p-2 bg-light" style="margin-bottom: 0; white-space: pre-wrap;">{{ material | safe }}</pre>

                    {# Crypto Key Search Button #}
                    {% set query = {"processed_analysis.crypto_material.matches": {"$contains": [{"hashes": [match.hashes[loop.index0]]}]}} | json_dumps %}
                    <button class="btn btn-outline-secondary btn-sm" type="button" style="margin-bottom: 10px" onclick="window.location.href='{{ '/database/browse?query=' + query | urlencode }}'">
                        <span class="fas fa-search"></span> Search for other occurrences
                    </button>
                </td>
            </tr>
        {% endfor %}
    {% endfor %}

{% endblock %}
